package com.dzirtbry.MedicineAnalizer.Types;

import java.io.Serializable;

public class MedicineTransaction implements Serializable{
	public void setId(int id) {
		medicine.setId(id);
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 7909883487142771016L;
	private Medicine medicine;
	public Medicine getMedicine() {
		return medicine;
	}

	public void setMedicine(Medicine medicine) {
		this.medicine = medicine;
	}

	public void setName(String name) {
		medicine.setName(name);
	}

	public void setPrice(double price) {
		medicine.setPrice(price);
	}

	private double transactionAmount;
	
	public String getName() {
		return medicine.getName();
	}

	public int getId() {
		return medicine.getId();
	}

	public double getPrice() {
		return medicine.getPrice();
	}

	public MedicineTransaction(int id, String name, double price, double amount) {
		medicine = new Medicine(name, id, price);
		transactionAmount = amount;
	}
	
	public MedicineTransaction () {
	}
	
	public MedicineTransaction (Medicine med, int amount) {
		medicine = new Medicine(med.getName(),med.getId(),med.getPrice());
		transactionAmount = amount;
	}
	
	double getFullPrice () {
		return medicine.getPrice() * transactionAmount;
	}

	public double getTransactionAmount() {
		return transactionAmount;
	}

	public void setTransactionAmount(double transactionAmount) {
		this.transactionAmount = transactionAmount;
	}
	
	@Override
	public String toString() {
		return "[Medicine: " + medicine.toString() + ", amount = " + String.format("%.2f", transactionAmount) + "]";
	}
}
